﻿#ifndef MYPUSHBUTTONFOURARITHMETIC_H
#define MYPUSHBUTTONFOURARITHMETIC_H

#include <QWidget>
#include <QPushButton>
#include <QPainter>
#include <QMouseEvent>
#include <QApplication>

#include "mynamespace.h"

class MyPushButtonFourArithmeticPrivate;
class MyPushButtonFourArithmetic : public QPushButton
{
    Q_OBJECT

    Q_PROPERTY(int imageLayerIndex READ getImageLayerIndex WRITE setImageLayerIndex)

    Q_PROPERTY(int leftOperandDeviceIndex READ getLeftOperandDeviceIndex WRITE setLeftOperandDeviceIndex)
    Q_PROPERTY(int rightOperandDeviceIndex READ getRightOperandDeviceIndex WRITE setRightOperandDeviceIndex)
    Q_PROPERTY(My::ObjectType leftOperandObjectType READ getLeftOperandObjectType WRITE setLeftOperandObjectType)
    Q_PROPERTY(My::ObjectType rightOperandObjectType READ getRightOperandObjectType WRITE setRightOperandObjectType)
    Q_PROPERTY(int leftOperandObjectIndex READ getLeftOperandObjectIndex WRITE setLeftOperandObjectIndex)
    Q_PROPERTY(int rightOperandObjectIndex READ getRightOperandObjectIndex WRITE setRightOperandObjectIndex)

    Q_PROPERTY(My::FourArithmeticType arithmeticType READ getArithmeticType WRITE setArithmeticType)
    Q_PROPERTY(My::NumberType leftOperandNumberType READ getLeftOperandNumberType WRITE setLeftOperandNumberType)
    Q_PROPERTY(My::NumberType rightOperandNumberType READ getRightOperandNumberType WRITE setRightOperandNumberType)
    Q_PROPERTY(My::NumberBaseType leftOperandBaseType READ getLeftOperandBaseType WRITE setLeftOperandBaseType)
    Q_PROPERTY(My::NumberBaseType rightOperandBaseType READ getRightOperandBaseType WRITE setRightOperandBaseType)
    Q_PROPERTY(double leftOperand READ getLeftOperand WRITE setLeftOperand)
    Q_PROPERTY(double rightOperand READ getRightOperand WRITE setRightOperand)

    Q_PROPERTY(int resultDeviceIndex READ getResultDeviceIndex WRITE setResultDeviceIndex)
    Q_PROPERTY(My::ObjectType resultObjectType READ getResultObjectType WRITE setResultObjectType)
    Q_PROPERTY(int resultObjectIndex READ getResultObjectIndex WRITE setResultObjectIndex)

    Q_PROPERTY(bool displayDefault READ getDisplayDefault WRITE setDisplayDefault)

public:
    explicit MyPushButtonFourArithmetic(QWidget *parent = nullptr);
    ~MyPushButtonFourArithmetic();

    /* Property Interface */
    int getImageLayerIndex() const;
    void setImageLayerIndex(int imageLayerInd);

    int getLeftOperandDeviceIndex() const;
    void setLeftOperandDeviceIndex(int deviceInd);

    int getRightOperandDeviceIndex() const;
    void setRightOperandDeviceIndex(int deviceInd);

    My::ObjectType getLeftOperandObjectType() const;
    void setLeftOperandObjectType(My::ObjectType);

    My::ObjectType getRightOperandObjectType() const;
    void setRightOperandObjectType(My::ObjectType);

    int getLeftOperandObjectIndex() const;
    void setLeftOperandObjectIndex(int);

    int getRightOperandObjectIndex() const;
    void setRightOperandObjectIndex(int);

    My::FourArithmeticType getArithmeticType() const;
    void setArithmeticType(My::FourArithmeticType);

    My::NumberType getLeftOperandNumberType() const;
    void setLeftOperandNumberType(My::NumberType);

    My::NumberType getRightOperandNumberType() const;
    void setRightOperandNumberType(My::NumberType);

    My::NumberBaseType getLeftOperandBaseType() const;
    void setLeftOperandBaseType(My::NumberBaseType);

    My::NumberBaseType getRightOperandBaseType() const;
    void setRightOperandBaseType(My::NumberBaseType);

    double getLeftOperand() const;
    void setLeftOperand(double);

    double getRightOperand() const;
    void setRightOperand(double);

    int getResultDeviceIndex() const;
    void setResultDeviceIndex(int);

    My::ObjectType getResultObjectType() const;
    void setResultObjectType(My::ObjectType);

    int getResultObjectIndex() const;
    void setResultObjectIndex(int);

    bool getDisplayDefault() const;
    void setDisplayDefault(bool);

protected:
    void paintEvent(QPaintEvent *ev) override;

    void enterEvent(QEvent *ev) override;
    void leaveEvent(QEvent *ev) override;
    void mousePressEvent(QMouseEvent *ev) override;
    void mouseReleaseEvent(QMouseEvent *ev) override;
    void mouseMoveEvent(QMouseEvent *ev) override;

private:
    Q_DISABLE_COPY(MyPushButtonFourArithmetic);
    MyPushButtonFourArithmeticPrivate *d;

};

#endif // MYPUSHBUTTONFOURARITHMETIC_H
